from utils.utils import CommonUtils, account_config


class IconName:
    main_castle = "main_castle.png"
    sos = "sos.png"
    confirm = "confirm_1.png"
    close = "close.png"
    mojo = "mojo.png"
    space_gate = "space_gate.png"
    space_gate_1 = "space_gate_1.png"
    space_gate_tran = "space_gate_tran.png"

    fight = "fight_1.png"

    xlc_2x = "xlc_2x.png"
    xlc_refresh = "xlc_refresh.png"
    xlc_close = "xlc_close.png"
    xlc_batch = "xlc_batch.png"
    xlc_6batch = "xlc_6x.png"
    xlc_tiaoguo = "xlc_tiaoguo.png"

    ll_attack = "ll_attack.png"

    read = "read.png" # 读取阵型
    paiqian = "paiqian.png" # 牢笼派遣
    tax = "tax.png" # 征税
    chejun = "chejun.png" # 撤军
    tanxian = "tanxian.png" # 去挖矿
    cage_check = "cage_check.png" # 牢笼查看
    s_lineup = "s_lineup.png" # 牢笼查看
    cage_back = "cage_back.png" # 牢笼返回

    jingongzhanbao = "jingongzhanbao.png"


class CommonConfig:
    package_name = "com.camelgames.hogwarts"

    # 网络请求超时等待时间
    net_t_o = 10
    # 普通超市等待时间
    n_t_o = 2
    # 设备运行额外等待时间
    extra_t_o = 5

    # 训练场战斗等待时间
    t_t_o = 30

    # 右上角的关闭按钮
    close_position = (0.982, 0.021)

    # 屏幕正中心
    center_position = (0.5, 0.49)

    # 右下角确定按钮
    right_bottom_position = (0.948, 0.914)

    # 训练场按钮
    train_position = (0.044, 0.676)

    # 邮箱按钮
    email_position = (0.144, 0.925)
    # 邮箱 -> 战报按钮
    attack_report_position = (0.286, 0.145)

    # 功勋号的名称
    gx_names = ["【官方】功勋号⑤", "【官方】功勋号④", "【官方】功勋号③", "【官方】功勋号②", "【官方】功勋号①"]
    # gx_names = ["【官方】功勋号⑤", "【官方】功勋号④", "【官方】功勋号③", "【官方】功勋号②"]

    # 点击牢笼后的查看按钮位置
    cage_check = (0.606, 0.423)

    cage_config = account_config().get("cage_config", {})

    @property
    def e_t_o(self) -> int:
        return self.n_t_o + self.extra_t_o

    @staticmethod
    def img_path(name):
        return CommonUtils.resource_path(["resource", name])